package org.jin.samples.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="exam_score")
public class ExamScore implements Serializable{

	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue
	@Column(name="id", nullable=false)
	private int id;
	
	@ManyToOne(cascade = {CascadeType.DETACH, CascadeType.PERSIST, CascadeType.MERGE})
	@JoinColumn(name="user_id")
	private ExamUser userId;
	
	@ManyToOne(cascade = {CascadeType.DETACH, CascadeType.PERSIST, CascadeType.MERGE})
	@JoinColumn(name="subject_id")
	private ExamSubject subjectId;
	
	@Column(name="exam_time")
	private Date examTime;

	@Column(name="score",nullable=false)
	private Integer score;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getExamTime() {
		return examTime;
	}

	public void setExamTime(Date examTime) {
		this.examTime = examTime;
	}

	public Integer getScore() {
		return score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

	public ExamUser getUserId() {
		return userId;
	}

	public void setUserId(ExamUser userId) {
		this.userId = userId;
	}

	public ExamSubject getSubjectId() {
		return subjectId;
	}

	public void setSubjectId(ExamSubject subjectId) {
		this.subjectId = subjectId;
	}

	public ExamScore() {
		super();
	}
	
}
